#include "mainwindow.h"
#include "ui_mainwindow.h"



MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QRadialGradient alphaGradient(ui->label->rect().center(),ui->label->height());

    alphaGradient.setColorAt(0, Qt::transparent);
    alphaGradient.setColorAt(0.2, Qt::green);
    alphaGradient.setColorAt(0.4, Qt::transparent);
    alphaGradient.setColorAt(0.6, Qt::green);
    alphaGradient.setColorAt(0.8, Qt::transparent);
    alphaGradient.setColorAt(1, Qt::green);
    mpGraphicsOpacityEffect = new QGraphicsOpacityEffect(this);
    mpGraphicsOpacityEffect->setOpacityMask(alphaGradient);
    ui->label->setGraphicsEffect(mpGraphicsOpacityEffect);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_horizontalSlider_valueChanged(int value)
{
     mpGraphicsOpacityEffect->setOpacity(value/100.0);
}

